<?php
	
	$resource = isset($_REQUEST['resource']) ? $_REQUEST['resource'] : '';
	//$resource = "http://ya.net";
	if($resource) {
		//$headers = curl_getinfo();
		$headers = @get_headers($resource);
		if($headers){
			if(preg_match('/[0-9]{3}/', $headers[0], $matches)){
				print json_encode(array('result' => 'success', 'data' => $matches[0]));
			}
		} else {
			print json_encode(array('result' => 'error'));
		}
	} else {
		print json_encode(array('result' => 'error'));
	}
	exit();

?>